/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"

castellatedMesh on;
snap            on;
addLayers       off;

geometry
{
    shell
    {
        type            triSurface;
        file            "shell.stl";
        regions
        {
            lower           { name lower; }
            upper           { name upper; }
            walls           { name walls; }
        }
    }
    tube
    {
        type            triSurface;
        file            "tube.stl";
        regions
        {
            lower           { name lower; }
            upper           { name upper; }
            walls           { name walls; }
        }
    }
    solid
    {
        type            triSurface;
        file            "solid.stl";
        regions
        {
            external        { name external; }
        }
    }
    shell_to_solid
    {
        type            triSurface;
        file            "shell_to_solid.stl";
    }
    tube_to_solid
    {
        type            triSurface;
        file            "tube_to_solid.stl";
    }
};

castellatedMeshControls
{
    features
    (
    );

    refinementSurfaces
    {
        shell
        {
            level           (1 1);
            regions
            {
                lower           { level (1 1); patchInfo { type patch; } }
                upper           { level (1 1); patchInfo { type patch; } }
                walls           { level (1 1); patchInfo { type wall; } }
            }
        }
        tube
        {
            level           (1 1);
            regions
            {
                lower           { level (1 1); patchInfo { type patch; } }
                upper           { level (1 1); patchInfo { type patch; } }
                walls           { level (1 1); patchInfo { type wall;  } }
            }
        }
        solid
        {
            level           (1 1);
            regions
            {
                external        { level (1 1); patchInfo { type wall; } }
            }
        }
        shell_to_solid
        {
            level           (1 1);
            faceZone        shell_to_solid;
            cellZone        shell;
            mode        inside;
        }
        tube_to_solid
        {
            level           (1 1);
            faceZone        tube_to_solid;
            cellZone        tube;
            mode        inside;
        }
    }

    insidePoint (0 0.008 0.015);

    nCellsBetweenLevels 2;

    resolveFeatureAngle 15;
}

snapControls
{
    implicitFeatureSnap    true;
}

addLayersControls
{
    layers
    {
        walls
        {
            nSurfaceLayers 2;
            mergeFaces true;
        }
        shell_to_solid
        {
            nSurfaceLayers 2;
            mergeFaces false;
        }
        tube_to_solid
        {
            nSurfaceLayers 2;
            mergeFaces false;
        }
    }

    relativeSizes       true;
    expansionRatio      1.2;
    finalLayerThickness 0.5;
    minThickness        1e-3;
}

mergeTolerance 1e-6;

// ************************************************************************* //
